using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_GuarStatementMap : EntityTypeConfiguration<so_GuarStatement>
    {
        public so_GuarStatementMap()
        {
            // Primary Key
            this.HasKey(t => new { t.sumfields, t.dimfields });

            // Properties
            this.Property(t => t.Guarantor__)
                .HasMaxLength(10);

            this.Property(t => t.Document_Type)
                .HasMaxLength(10);

            this.Property(t => t.Card__)
                .HasMaxLength(50);

            this.Property(t => t.Patient)
                .HasMaxLength(80);

            this.Property(t => t.Insured)
                .HasMaxLength(50);

            this.Property(t => t.Relation)
                .HasMaxLength(50);

            this.Property(t => t.Number)
                .HasMaxLength(10);

            this.Property(t => t.batch)
                .HasMaxLength(8);

            this.Property(t => t.notes)
                .HasMaxLength(50);

            this.Property(t => t.HeaderView)
                .HasMaxLength(49);

            this.Property(t => t.sumfields)
                .IsRequired()
                .HasMaxLength(58);

            this.Property(t => t.dimfields)
                .IsRequired()
                .HasMaxLength(1);

            // Table & Column Mappings
            this.ToTable("so_GuarStatement");
            this.Property(t => t.Guarantor__).HasColumnName("Guarantor_#");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Document_Type).HasColumnName("Document_Type");
            this.Property(t => t.voucher).HasColumnName("voucher");
            this.Property(t => t.Card__).HasColumnName("Card_#");
            this.Property(t => t.Patient).HasColumnName("Patient");
            this.Property(t => t.Insured).HasColumnName("Insured");
            this.Property(t => t.Relation).HasColumnName("Relation");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.Bill_Amount).HasColumnName("Bill_Amount");
            this.Property(t => t.Discount).HasColumnName("Discount");
            this.Property(t => t.Patient_Amount).HasColumnName("Patient_Amount");
            this.Property(t => t.Amount).HasColumnName("Amount");
            this.Property(t => t.Base_1).HasColumnName("Base_1");
            this.Property(t => t.Base_2).HasColumnName("Base_2");
            this.Property(t => t.Document_id).HasColumnName("Document_id");
            this.Property(t => t.batch).HasColumnName("batch");
            this.Property(t => t.notes).HasColumnName("notes");
            this.Property(t => t.HeaderView).HasColumnName("HeaderView");
            this.Property(t => t.sumfields).HasColumnName("sumfields");
            this.Property(t => t.dimfields).HasColumnName("dimfields");
        }
    }
}
